package com.sys.db.daoImpl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.sys.db.dao.RunFlowJobDao;
import com.sys.pojo.RunFlowJob;

public class RunFlowJobDaoImpl extends SqlMapClientDaoSupport implements RunFlowJobDao {

	public void delete(int id) throws Exception {
		this.getSqlMapClientTemplate().delete("RunFlowJob.delete",id);
	}

	public List findAll() throws Exception {
		List list=this.getSqlMapClientTemplate().queryForList("RunFlowJob.findAll");
		return list;
	}
	public List findByPage(int start,int limit) throws Exception {
		Map map=new HashMap<String,Integer>();
		map.put("start", start);
		map.put("end", start+limit);
		List list=this.getSqlMapClientTemplate().queryForList("RunFlowJob.findByPage",map);
		return list;
	}
	public RunFlowJob findById(int id) throws Exception {
		RunFlowJob d=(RunFlowJob) this.getSqlMapClientTemplate().queryForObject("RunFlowJob.findById",id);
		return d;
	}

	public void save(RunFlowJob runFlowJob) throws Exception {
		this.getSqlMapClientTemplate().insert("RunFlowJob.insert",runFlowJob);
	}

	public void update(RunFlowJob runFlowJob) throws Exception {
		this.getSqlMapClientTemplate().update("RunFlowJob.update",runFlowJob);
	}

	public List findByFlowId(int flowId) throws Exception {
		List list=this.getSqlMapClientTemplate().queryForList("RunFlowJob.findByFlowId", flowId);
		return list;
	}

	public void deleteByFlowId(int flowId) throws Exception {
		this.getSqlMapClientTemplate().delete("RunFlowJob.deleteByFlowId",flowId);
	}

	public List findByJobId(int jobId,int flowId) throws Exception {
		Map map=new HashMap<String,Integer>();
		map.put("jobId", jobId);
		map.put("flowId", flowId);
		List list=this.getSqlMapClientTemplate().queryForList("RunFlowJob.findByJobId",map);
		return list;
	}
	

}
